package com.xqls.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xqls.bean.PublicStormwaterRealdataBean;
import com.xqls.dal.dao.mybatis.PublicStormwaterRealdataDaoImpl;
import com.xqls.dal.model.PublicStormwaterRealdata;
import com.xqls.service.PublicStormwaterRealdataService;
import com.xqls.util.ObjectUtil;
@Service
public class PublicStormwaterRealdataServiceImpl implements PublicStormwaterRealdataService{

	
	@Autowired private PublicStormwaterRealdataDaoImpl realdataDao;
	@Override
	public List<Map<String, Object>> selectByMap(Map<String, Object> map) {
		return realdataDao.selectByMap(map);
	}
	
	public boolean insertPublicStormwaterRealdata(PublicStormwaterRealdataBean publicStormwaterRealdataBean){
		PublicStormwaterRealdata realdata=(PublicStormwaterRealdata) ObjectUtil.transfer(publicStormwaterRealdataBean, PublicStormwaterRealdata.class);
		return realdataDao.insertPublicStormwaterRealdata(realdata)>0;
	}
	
	public boolean updatePublicStormwaterRealdata(PublicStormwaterRealdataBean publicStormwaterRealdataBean){
		PublicStormwaterRealdata realdata=(PublicStormwaterRealdata) ObjectUtil.transfer(publicStormwaterRealdataBean, PublicStormwaterRealdata.class);
		return realdataDao.updatePublicStormwaterRealdata(realdata)>0;
	}
	public PublicStormwaterRealdataBean queryByRealdataNo(Integer realdataNo){
		return (PublicStormwaterRealdataBean) ObjectUtil.transfer(realdataDao.queryByRealdataNo(realdataNo), PublicStormwaterRealdataBean.class);
	}
	
	
	public PublicStormwaterRealdataBean queryByDeviceNo(String deviceNo) {
		PublicStormwaterRealdata publicStormwaterRealdatas=realdataDao.selectByDeviceNo(deviceNo);
		if(publicStormwaterRealdatas==null) return  null;
		return (PublicStormwaterRealdataBean) ObjectUtil.transfer(publicStormwaterRealdatas, PublicStormwaterRealdataBean.class);
	}
	
	@Override
	public List<Map<String, Object>> queryAll() {
		return realdataDao.queryAll();
	}
	
	public PublicStormwaterRealdata selectByDeviceNo(String deviceNo){
		return realdataDao.selectByDeviceNo(deviceNo);
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<PublicStormwaterRealdataBean> selectListByMap(Map<String, Object> map) {
		return ObjectUtil.transferList(realdataDao.selectListByMap(map),PublicStormwaterRealdataBean.class);
	}

	@Override
	public List<PublicStormwaterRealdata> selectPublic() {
		return realdataDao.selectPublic();
	}

}
